﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using DLL;

namespace QuanLyBanLe.Depository
{
    public partial class FormSelectOutProdPaperType : Form
    {
        private ShopService m_ShopService;

        public FormSelectOutProdPaperType()
        {
            InitializeComponent();
            m_ShopService = new ShopService();
        }

        private void FormSelectOutProdPaperType_Load(object sender, EventArgs e)
        {
            List<Shop> shops = m_ShopService.GetAll();
            cboToShop.DataSource = shops;
            cboToShop.ValueMember = "Id";
            cboToShop.DisplayMember = "Name";
        }

        private void rdbOutProd_CheckedChanged(object sender, EventArgs e)
        {
            if (rdbOutProd.Checked)
            {
                cboToShop.Enabled = false;
            }
        }

        private void rdbMoveProd_CheckedChanged(object sender, EventArgs e)
        {
            if (rdbMoveProd.Checked)
            {
                cboToShop.Enabled = true;
            }
        }

        private void btnCreateOutProdPaper_Click(object sender, EventArgs e)
        {
            if (rdbOutProd.Checked)
            {
                this.Close();
                FormOutProdPaper frm = new FormOutProdPaper();
                frm.Show();
            }
            else
            {
                int shopId = Convert.ToInt32(cboToShop.SelectedValue);
                FormOutProdPaper frm = new FormOutProdPaper(shopId);
                this.Close();
                frm.Show();
            }
        }
    }
}
